<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Window3D.pb</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#006666">;
</font><font color="#006666">; ------------------------------------------------------------
</font><font color="#006666">;
</font><font color="#006666">;   PureBasic - Window 3D
</font><font color="#006666">;
</font><font color="#006666">;    (c) Fantaisie Software
</font><font color="#006666">;
</font><font color="#006666">; ------------------------------------------------------------
</font><font color="#006666">;
</font>  
<font color="#924B72">#MainWindow</font> = 0
<font color="#924B72">#CloseButton</font> = 0

<b><font color="#006666">IncludeFile</font></b> <font color="#924B72">#PB_Compiler_Home</font> + "examples/3d/Screen3DRequester.pb"

<b><font color="#006666">Define</font></b>.f KeyX, KeyY, MouseX, MouseY

<b><font color="#006666">If</font></b> <font color="#006666">InitEngine3D</font>()
  
<font color="#006666">  Add3DArchive</font>(<font color="#924B72">#PB_Compiler_Home</font> + "examples/3d/Data/GUI", <font color="#924B72">#PB_3DArchive_FileSystem</font>)
<font color="#006666">  Add3DArchive</font>(<font color="#924B72">#PB_Compiler_Home</font> + "examples/3d/Data/Packs/desert.zip", <font color="#924B72">#PB_3DArchive_Zip</font>)

    
<font color="#006666">  InitSprite</font>()
<font color="#006666">  InitKeyboard</font>()
<font color="#006666">  InitMouse</font>()
  
  <b><font color="#006666">If</font></b> <font color="#006666">Screen3DRequester</font>()
    
<font color="#006666">    SkyBox</font>("desert07.jpg")

<font color="#006666">    CreateCamera</font>(0, 0, 0, 100, 100)  <font color="#006666">; Front camera
</font><font color="#006666">    MoveCamera</font>(0,0,100,100, <font color="#924B72">#PB_Absolute</font>)
    
    
<font color="#006666">    OpenWindow3D</font>(<font color="#924B72">#MainWindow</font>, 100, 100, 300, 100, "Hello in 3D !")
		
<font color="#006666">			ButtonGadget3D</font>(<font color="#924B72">#CloseButton</font>, 150, 40, 120, 25, "Quit")
			
<font color="#006666">  	ShowGUI</font>(128, 1) <font color="#006666">; Display the GUI, semi-transparent and display the mouse cursor
</font>    		
    <b><font color="#006666">Repeat</font></b>
<font color="#006666">      Screen3DEvents</font>()

      <b><font color="#006666">If</font></b> <font color="#006666">ExamineKeyboard</font>() <b><font color="#006666">And</font></b> <font color="#006666">ExamineMouse</font>()
        Input$ =<font color="#006666"> KeyboardInkey</font>()
        
<font color="#006666">        InputEvent3D</font>(<font color="#006666">MouseX</font>(),<font color="#006666"> MouseY</font>(),<font color="#006666"> MouseButton</font>(<font color="#924B72">#PB_MouseButton_Left</font>), Input$, 0)
      <b><font color="#006666">EndIf</font></b>
      
      <font color="#006666">; Handle the GUI 3D events, it's similar to regular GUI events
</font>      <font color="#006666">;
</font>      <b><font color="#006666">Repeat</font></b>
      	Event =<font color="#006666"> WindowEvent3D</font>()
      	
      	<b><font color="#006666">Select</font></b> Event
      		<b><font color="#006666">Case</font></b> <font color="#924B72">#PB_Event3D_CloseWindow</font>
      		  <b><font color="#006666">If</font></b> <font color="#006666">EventWindow3D</font>() = <font color="#924B72">#MainWindow</font>
<font color="#006666">      		    CloseWindow3D</font>(<font color="#924B72">#MainWindow</font>)
      		  <b><font color="#006666">EndIf</font></b>
      		  
      		<b><font color="#006666">Case</font></b> <font color="#924B72">#PB_Event3D_Gadget</font>
      		  <b><font color="#006666">If</font></b> <font color="#006666">EventGadget3D</font>() = <font color="#924B72">#CloseButton</font>
      		    Quit = 1
      		  <b><font color="#006666">EndIf</font></b>
      			
      	<b><font color="#006666">EndSelect</font></b>
     	<b><font color="#006666">Until</font></b> Event = 0
     	
<font color="#006666">      RenderWorld</font>()
      
<font color="#006666">      FlipBuffers</font>()
    <b><font color="#006666">Until</font></b> <font color="#006666">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Escape</font>) <b><font color="#006666">Or</font></b> Quit = 1
  <b><font color="#006666">EndIf</font></b>
    
<b><font color="#006666">Else</font></b>
<font color="#006666">  MessageRequester</font>("Error", "The 3D Engine can't be initialized", 0)
<b><font color="#006666">EndIf</font></b></font></pre>
</body></html>
